//package com.cg.mq;
//
//import com.cg.domain.entity.UserBehavior;
//import com.cg.mapper.UserBehaviorMapper;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//@Slf4j
//@Component
//@RabbitListener(queues = "user.behavior.queue")
//public class BehaviorConsumer {
//
//    @Autowired
//    private UserBehaviorMapper userBehaviorMapper;
//
//    @RabbitHandler
//    public void handler(UserBehavior userBehavior){
//        log.info("[BehaviorConsumer] 接收到消息: {}", userBehavior);
//        try {
//            userBehaviorMapper.insert(userBehavior);
//        } catch (Exception e) {
//            log.error("[BehaviorConsumer] 持久化失败", e);
//        }
//    }
//}
//

